'''
    MySql methods 
'''
import MySQLdb
from conf import *

gSQLExecResult = None

class MySqlDBHandle():
    @staticmethod
    def execSqlStatement(iSQLStatement):
        try:
            conn = MySQLdb.connect(host=gDBHost, port=gDBPort, user=gDBUser, passwd=gDBPassword, db=gDBSchema, charset="utf8")
            cursor = conn.cursor()
            cursor.execute(iSQLStatement)
            gSQLExecResult = cursor.fetchall()
            conn.commit()
            conn.close()
            return gSQLExecResult
        except Exception, e:
            print 'Error when execting sql %s ' % (iSQLStatement)
            return None
